package exception;

/**
 * @author Administrator
 * @Description
 * @date 2022/5/5 16:10
 **/
public class ThrowDemo {
    public static void main(String[] args) {
        Person p = new Person();
        try {
            p.setAge(2222);

            System.out.println("我今年" + p.getAge() + "岁");
        } catch (IllegalAgeException e) {
            System.out.println("年龄超范围");
            e.printStackTrace();
        }
    }
}
